let arr = [1,2,3,4,2,1]

function unique(arr) {
    return [...new set(arr)]
}

console.log(unique(arr));
